/*****目标团队*****/
<template>
    <!---->
    <search-table
	    ref="searchTable"
		:columns="topoTargetCol"
        :data="topoTargetData"
		:total="topoTargetTotal"
		:page.sync="queryTopoTargetInfo.pageIndex"
		:size.sync="queryTopoTargetInfo.pageSize"
		:disabled = "(data) => {
			return disabledAllBtn || data.publicTarget ? true : false
		}"
		showSelectTag
		:selection.sync="selectTargetTeams"
		@change-size="getTargetSize"
		@change-page="getTargetPage"
	>
    <Alert type="warning" show-icon v-if="configMode !== 1" slot="alert">
        <p style="color: #f90">注意事项:</p>
        <template v-if="hwType !== 1">
            <p>
                1.导入目标之前，请先去“拓扑页 > 展示编辑 > 3D编辑 >
                地理区域划分”中，进行“行政区”处理
            </p>
            <p>
                2.复杂模式下，导入成功后，请前往”报告持续提交”页面，修改包含“目标方管理员组”的任务
            </p>
        </template>
        <p v-else>
            1.复杂模式下，导入成功后，请前往”报告持续提交”页面，修改包含“目标方管理员组”的任务
        </p>
    </Alert>
    <template slot="search">
            <!-- <Checkbox
                v-model="selectAll"
                :disabled="topoTargetData.length === 0 || disabledAllBtn || disCheckAll"
                @on-change="selectAllChange"
                style="margin-bottom: 8px"
                >全选</Checkbox
            > -->
            <Button
                type="primary"
                ghost
                icon="ios-create-outline"
                @click="batchSetTopoTargetPublic"
                :disabled="checkTargetIds.length == 0 || disabledAllBtn"
                class="mr15"
                >批量设为公共目标</Button
            >
            <Upload
                ref="upload"
                class="mr15"
                v-if="configMode !== 1"
                :action="mixinUploadAction"
                :show-upload-list="false"
                :on-format-error="mixinHandleFormatError"
                :on-success="getImageUrl"
                :format="mixinFormat"
                :before-upload="mixinBeforeUpload"
                :headers="mixinUploadHeader"
                style="display: inline-block"
            >
            <!-- :max-size="mixinMaxSize"  :on-exceeded-size="mixinFileHasExceed" -->
                <Button
                    type="primary"
                    ghost
                    icon="ios-cloud-upload-outline"
                    :disabled="disabledAllBtn"
                >
                    导入目标
                    <WarningTip
                        :content="showTip"
                        style="vertical-align: text-bottom"
                    ></WarningTip>
                </Button>
            </Upload>
            <Button
                type="primary"
                ghost
                icon="md-add"
                class="mr15"
                @click="showAddAndUpdate('')"
                :disabled="disabledAllBtn"
                v-if="showAddTarget"
            > 添加目标
            </Button>
            <Button
                type="primary"
                ref="downloadTemplateBtn"
                ghost
                v-if="configMode !== 1"
                icon="ios-cloud-download-outline"
                :disabled="disabledAllBtn"
                @click="downloadTemplate"
                class="mr15"
            >
                <!--#57a3f3-->
                <a :href="mixinTemplateUrl" download="" @click.stop
                    >模板下载</a
                >
            </Button>
            <Button
                type="primary"
                ghost
                icon="ios-nuclear-outline"
                @click="issuedRules"
                :loading="issuedLoading"
                v-if="(!allowChangeIp || deployMode === 2) && configMode !== 1"
                :disabled="disabledAllBtn"
                class="mr15"
                >下发规则</Button
            >
            <Button
                type="primary"
                ghost
                icon="ios-cloud-download-outline"
                @click="exportAdminExcel"
                :disabled="disabledAllBtn"
                class="mr15"
            >
                <a :href="exportAdminUrl">导出管理员列表</a>
            </Button>
            <Button
                type="primary"
                ghost
                icon="ios-cloud-download-outline"
                :disabled="disabledAllBtn"
                class="mr15"
            >
                <a :href="downloadTargetUrl">导出目标</a>
            </Button>
            <!-- <Button
    type="primary"
    ghost
    icon="ios-nuclear-outline"
    @click="checkTopoTargetPosNum"
    :disabled="disabledAllBtn"
    class="mr15"
    >校验区域目标位置数量</Button
>
<Button
    type="primary"
    ghost
    @click="assignTopoTargetPos"
    :disabled="disabledAllBtn"
    class="mr15"
    ><img src="../../../../assets/scene/target-allot-purple.png" alt="" />分配目标位置
</Button> -->
            <Button
                type="primary"
                icon="ios-create-outline"
                ghost
                @click="openCompanyModal"
                :disabled="disabledAllBtn"
                class="mr15"
                >修改单位
            </Button>
            <Input
                v-model.trim="queryTopoTargetInfo.name"
                placeholder="名称"
                style="width: 150px"
                class="mr15"
                @on-change="debounceSearch"
            ></Input>
            <Input
                v-model.trim="queryTopoTargetInfo.district"
                placeholder="区域"
                style="width: 150px"
                class="mr15"
                @on-change="debounceSearch"
            ></Input>
            <!-- <Input
    v-model.trim="queryTopoTargetInfo.company"
    placeholder="单位"
    style="width:150px"
    class="mr15"
    @on-change="debounceSearch"
></Input> -->
            <Input
                v-model.trim="queryTopoTargetInfo.groupName"
                placeholder="分组"
                style="width: 150px"
                @on-change="debounceSearch"
            ></Input>
            <Input
                v-model.trim="queryTopoTargetInfo.url"
                placeholder="Url"
                style="width: 150px"
                :maxlength="30"
                @on-change="debounceSearch"
            ></Input>
            <Input
                v-model.trim="queryTopoTargetInfo.edition"
                placeholder="版本信息"
                style="width: 150px"
                :maxlength="30"
                @on-change="debounceSearch"
            ></Input>
            <Select filterable
                v-model="queryTopoTargetInfo.company"
                placeholder="请选择单位"
                transfer
                filterable
                clearable
                style="width: 150px"
                @on-change="getTargetPage(1)"
            >
                <Option
                    :value="company"
                    v-for="company in companyList"
                    :key="company"
                    :title="company"
                    >{{ company }}</Option
                >
            </Select>
            <Select filterable
                v-model="queryTopoTargetInfo.category"
                placeholder="请选择类别"
                filterable
                clearable
                style="width: 150px"
                @on-change="getTargetPage(1)"
            >
                <Option
                    :value="item.value"
                    v-for="item in categoryArr"
                    :key="item.value"
                    :title="item.label"
                    >{{ item.label }}</Option
                >
            </Select>
            <Select filterable
                v-model="queryTopoTargetInfo.industry"
                placeholder="请选择行业"
                filterable
                clearable
                style="width: 150px"
                @on-change="getTargetPage(1)"
            >
                <Option
                    :value="item.dictid"
                    v-for="item in industryList"
                    :key="item.dictid"
                    :title="item.dictname"
                    >{{ item.dictname }}</Option
                >
            </Select>
            <Select filterable
                transfer
                v-model="queryTopoTargetInfo.publicTarget"
                placeholder="是否公共目标"
                clearable
                style="width: 150px"
                @on-change="getTargetPage(1)"
            >
                <Option value="1">是</Option>
                <Option value="0">否</Option>
            </Select>
            <Select filterable
                transfer
                v-model="queryTopoTargetInfo.available"
                placeholder="是否可用"
                clearable
                style="width: 150px"
                @on-change="getTargetPage(1)"
            >
                <Option value="true">是</Option>
                <Option value="false">否</Option>
            </Select>
    </template>
        <Modal
            v-model="targetModal.show"
            :title="targetModal.title"
            :loading="targetModal.loading"
            width="600px"
            :mask-closable="false"
            @on-cancel="handleReset('formValidate')"
            @on-ok="saveTopoTarget"
        >
            <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
              
                
                <FormItem label="应用系统" prop="businessSystemId" v-if="showAsset">
                    <Select filterable v-model="formValidate.businessSystemId" :disabled='targetModal.type===2' v-if="!formValidate.businessSystemIdbck" placeholder="请选择应用系统" filterable clearable @on-change="changePropertyId">
                        <Option v-for="(item,index) in applicationData" :value="item.id" :key="item.id">{{item.name}}</Option >
                    </Select>
                    <Input
                        v-else
                        v-model.trim="formValidate.businessSystemName"
                        :maxlength="64"
                        disabled
                        :placeholder="nameErrorTip"
                    ></Input>
                </FormItem>


              
                <FormItem label="名称" prop="name">
                    <Input
                        v-model.trim="formValidate.name"
                        :maxlength="64"
                        :disabled="disabledName && formValidate.businessSystemId"
                        :placeholder="nameErrorTip"
                    ></Input>
                </FormItem>


              <!--                    1是新增，2 是修改 22172 -->
              <FormItem label="单位" prop="company">
                <Input
                    disabled
                    v-if="disabledName||targetModal.type==2"
                    v-model.trim="formValidate.company"
                    placeholder="单位"
                ></Input>
                <Select filterable
                    v-else
                    v-model="formValidate.company"
                    placeholder="请选择单位"
                    transfer
                    filterable
                >
                  <Option
                      :value="company"
                      v-for="company in companyList"
                      :key="company"
                      :title="company"
                  >{{ company }}</Option
                  >
                </Select>
              </FormItem>

              

              
              
                <FormItem label="Url地址" prop="url">
                    <Input v-model.trim="formValidate.url" placeholder="url"></Input>
                </FormItem>
                <!-- <FormItem label="是否可用" prop="available">
          <RadioGroup v-model="formValidate.available">
            <Radio label="1">可用</Radio>
            <Radio label="0">不可用</Radio>
          </RadioGroup>
        </FormItem> -->
                <!--  :disabled="targetModal.type == 2" -->

                <FormItem label="行业" prop="industry">
                    <Select filterable v-model="formValidate.industry" placeholder="请选择行业" filterable>
                        <Option
                            :value="item.dictid"
                            v-for="item in industryList"
                            :key="item.dictid"
                            :title="item.dictname"
                            >{{ item.dictname }}</Option
                        >
                    </Select>
                </FormItem>
                <FormItem label="类别" prop="category">
                    <Select filterable
                        v-model="formValidate.category"
                        placeholder="请选择类别"
                        filterable
                        clearable
                        style="width: 150px"
                        :disabled="targetModal.type == 2"
                    >
                        <Option
                            :value="item.value"
                            v-for="item in categoryArr"
                            :key="item.value"
                            :title="item.label"
                            >{{ item.label }}</Option
                        >
                    </Select>
                </FormItem>
                <FormItem label="分组" prop="groupName">
                    <Input
                        v-model.trim="formValidate.groupName"
                        placeholder="分组"
                        :maxlength="64"
                    ></Input>
                </FormItem>
                <FormItem label="区域" prop="district">
                    <Input
                        v-model.trim="formValidate.district"
                        placeholder="区域" 
                    ></Input>
                    <!-- <Select filterable
                        v-model="formValidate.district"
                        placeholder="请选择区域"
                        filterable
                        :disabled="targetModal.type == 2"
                        v-if="targetModal.type == 1"
                    >
                        <Option
                            :value="district"
                            v-for="district in districtList"
                            :key="district"
                            :title="district"
                            >{{ district }}</Option
                        >
                    </Select> -->
                </FormItem>
                <FormItem label="基础分" prop="basicScore">
                    <InputNumber
                        v-model.trim="formValidate.basicScore"
                        placeholder="基础分"
                    ></InputNumber>
                </FormItem>
                <FormItem label="Ip" prop="ip">
                    <Input
                        v-model.trim="formValidate.ip"
                        placeholder="多个ip请用，隔开,例如：192.168.1.12,192.168.1.13,192.168.1.14"

                    ></Input>
                </FormItem>
                <FormItem label="是否公共目标" prop="publicTarget">
                    <Select filterable
                        v-model="formValidate.publicTarget"
                        placeholder="请选择是否公共目标"
                        filterable
                    >
                        <Option value="1">是</Option>
                        <Option value="0">否</Option>
                    </Select>
                </FormItem>
                <FormItem label="经度" prop="x">
                    <Input number v-model.trim="formValidate.x" placeholder="经度"></Input>
                </FormItem>
                <FormItem label="纬度" prop="y">
                    <Input number v-model.trim="formValidate.y" placeholder="纬度"></Input>
                </FormItem>

              <FormItem label="中枢平台ID">
                <Input  v-model.trim="formValidate.centralPlatformId" placeholder="中枢平台ID" show-word-limit :maxlength="64"></Input>
              </FormItem>
              <FormItem label="数据中心ID">
                <Input  v-model.trim="formValidate.dataCentralId" placeholder="数据中心ID"  show-word-limit :maxlength="64"></Input>
              </FormItem>
              
                <FormItem label="备注" prop="remark">
                    <Input
                        v-model.trim="formValidate.remark"
                        type="textarea"
                        :autosize="{ minRows: 2, maxRows: 5 }"
                        placeholder="请输入备注"
                        clearable
                        :maxlength="200"
                    ></Input>
                </FormItem>
                <FormItem label="提示" prop="hint">
                    <Input
                        v-model.trim="formValidate.hint"
                        type="textarea"
                        :autosize="{ minRows: 2, maxRows: 5 }"
                        placeholder="请输入提示"
                        clearable
                        :maxlength="500"
                    ></Input>
                </FormItem>
                <FormItem label="版本信息" prop="edition">
                    <Input
                        v-model.trim="formValidate.edition"
                        :placeholder="`${domainTip},例如：v1.1`"
                        clearable
                        :disabled="disabledEdition"
                        :maxlength="20"
                    ></Input>
                </FormItem>
            </Form>
        </Modal>
        <Modal
            v-model="checkModal"
            title="校验结果"
            width="600px"
            :mask-closable="false"
            footer-hide
        >
            <Table border :columns="checkCol" :data="checkList"></Table>
        </Modal>
        <Modal
            v-model="companyModal.show"
            :title="companyModal.title"
            :loading="companyModal.loading"
            width="600px"
            :mask-closable="false"
            @on-ok="updateTargetCompany"
        >
            <Form
                ref="companyFormValidate"
                :model="companyFormValidate"
                :rules="companyRuleValidate"
                :label-width="80"
            >
                <FormItem label="旧单位" prop="oldCompany">
                    <Select filterable
                        v-model="companyFormValidate.oldCompany"
                        placeholder="请选择单位"
                        transfer
                        filterable
                    >
                        <Option
                            :value="company"
                            v-for="company in companyList"
                            :key="company"
                            :title="company"
                            >{{ company }}</Option
                        >
                    </Select>
                </FormItem>
                <FormItem label="新单位名" prop="newCompany">
                    <Input
                        v-model.trim="companyFormValidate.newCompany"
                        :maxlength="30"
                        placeholder="单位名"
                    ></Input>
                </FormItem>
            </Form>
        </Modal>
    </search-table>
</template>

<script>
import {
    getTopoTargetList,
    addTopoTarget,
    modifyTopoTarget,
    delTopoTarget,
    importTarget,
    queryNetworkList,
    getDistricts,
    exportAdminExcel,
    assignTopoTargetPos,
    checkTopoTargetPosNum,
    queryVmWithParty,
    getExecutionsResult,
    getDeclareCompanyList,
    batchSetTopoTargetPublic,
    updateTargetCompany,
} from '@/api/drill_compete';
import { getFlagServerList, getstatusbyprjid, issuedRules } from '@/api/drill';
import { getBusinessSystemList } from '@/api/product.js';
import { getaccessgrouplist } from '@/api/access_new';
import { allDirection } from '@/api/dict';
import hwTargetMangeMixin from '@/mixin/hwTargetMangeMixin';
import { debounce } from '@/libs/utils';
import { validateName1,nameErrorTip,validateDomain,domainTip } from '@/libs/reg';
import { mapGetters } from 'vuex'
export default {
    name: 'scenes',
    // props: ['type', 'disabledAllBtn', 'allowChangeIp', 'deployMode', 'configMode'],
    props:{
        type:{
            type:Number,
            default:()=> null,
        },
        disabledAllBtn:{
            type:Boolean,
            default:()=>false
        },
        allowChangeIp:{
            type:Boolean,
            default:()=>false
        },
        deployMode:{
            type:Number,
            default:()=>null
        },
        configMode:{
            type:Number,
            default:()=>null
        },
        showAddTarget:{
            type:Boolean,
            default:()=>false
        }
    },
    components: {},
    mixins: [hwTargetMangeMixin],
    data() {
        const validateNum = (rule, value, callback) => {
            //验证只能填入数字
            var reg = new RegExp('^([1-9]|[1-9]\\d|100)$');
            //验证警戒值
            if (value) {
                if (!reg.test(value)) {
                    callback(new Error('请输入1-100的整数'));
                } else {
                    callback();
                }
            } else {
                callback();
            }
        };
        const validateIPs = (rule, value, callback) => {
            //验证只能填入数字
            var reg = new RegExp(
                '^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'
            );
            //验证警戒值
            if (value) {
                let ipArr = value.split(',');
                if (ipArr.some((ip) => !reg.test(ip))) {
                    callback(new Error('ip格式错误'));
                } else {
                    callback();
                }
            } else {
                callback();
            }
        };
        const validateScore = (rule, value, callback) => {
            if (value !== 0 && !value) {
                callback(new Error('不能为空'));
                return;
            }
            if (!Number.isInteger(value)) {
                callback(new Error('请输入整数'));
                return;
            }
            if (value < 0 || value > 100000) {
                callback(new Error('请输入0-100000的整数'));
                return;
            }
            callback();
        };
               // 经度
   const validatorLongitude = (rule, value, callback) =>{
        const reg = /^(\-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,15})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,15}|180)$/
        if(value === "" || !value){
            callback();
        }else{
            if(!reg.test(value)){
                callback(new Error('经度范围：-180~180'));
            }
            callback();
        }
    };
    // 维度
   const validatorLatitude = (rule, value, callback)=> {
        const reg = /^(\-|\+)?([0-8]?\d{1}\.\d{0,15}|90\.0{0,15}|[0-8]?\d{1}|90)$/
        if(value === "" || !value){
            callback();
        }else{
            if(!reg.test(value)){
                callback(new Error('纬度范围：-90~90'));
            }
            callback();
        }
    };
        // const validateXY = (rule, value, callback) => {
        //   let val = Number(val);
        //   
        //   if (val && val !== 0 && Number.isNaN(val)) {
        //     callback(new Error('请输入数字'));
        //     return;
        //   }
        //   callback();
        // };
        // const validateX = (rule, value, callback) => {
        //   if (value && value !== 0 && (value < 0 || value > 180)) {
        //     callback(new Error('请输入0-180的数字'));
        //     return;
        //   }
        //   callback();
        // };
        // const validateY = (rule, value, callback) => {
        //   if (value && value !== 0 && (value < 0 || value > 90)) {
        //     callback(new Error('请输入0-90的数字'));
        //     return;
        //   }
        //   callback();
        // };

      
      
        return {
            domainTip,
            hwType: 1, //新护网，混入中做判断
            nameErrorTip,
            issuedLoading: false,
            routeParams: {
                id: this.$route.query.id,
                prjid: this.$route.query.prjid,
            },
            targetModal: {
                show: false,
                title: '',
                loading: true,
                type: 1, //1添加，2修改
            },
            pathList: [],
            accessGroupList: [],
            vmlists: [],
            teamlists: [],
            queryTopoTargetInfo: {
                pageIndex: 1,
                pageSize: 10,
                projectId: this.$route.query.prjid,
            },
            access: '1',
            formValidate: {
                businessSystemId:'',
                name: '',
                category: '',
                company: '',
                district: '', //区域
                id: '',
                industry: '',
                url: '',
                projectId: this.$route.query.prjid,
                available: '1',
                ip: '',
                publicTarget: '',
                groupName: '',
                basicScore: 0,
                remark: '',
                hint: '',
                x: '',
                y: '',
                edition:''
            },
            ruleValidate: {
                // ip: [{ validator: validateIPs, trigger: 'change' }],
                url: [{ required: true, message: '不能为空', trigger: 'change' }],
                company: [{ required: true, message: '不能为空', trigger: 'change' }],
                name: [
                    { required: true, message: '不能为空', trigger: 'blur' },
                    { validator: validateName1, trigger: 'change, blur' },
                ],
                publicTarget: [{ required: true, message: '不能为空', trigger: 'change' }],
                category: [{ required: true, message: '不能为空', trigger: 'change' }],
                industry: [{ required: true, message: '不能为空', trigger: 'change' }],
                basicScore: [{ required: true, validator: validateScore, trigger: 'change' }],
                // x:[{ validator: validateXY, trigger: 'change' }],
                // y:[{ validator: validateXY, trigger: 'change' }],
                 x:[{ required: false,validator: validatorLongitude, trigger: 'change' }],
                y:[{required: false, validator: validatorLatitude, trigger: 'change' }],
                edition:[{ validator: validateDomain, trigger: 'change' }]
            },
            querytime: {},
            categoryObj: {
                1: {
                    label: '一类',
                    value: '1',
                },
                2: {
                    label: '二类',
                    value: '2',
                },
                3: {
                    label: '三类',
                    value: '3',
                },
            },
            topoTargetCol: [
                {
                    type:'selection',
                    width:60,
                },
                {
                    title: '名称',
                    key: 'name',
                    align: 'center',
                    ellipsis: true,
                    tooltip: true,
                    width: 200,
                    placement: 'top-left',
                },
                {
                    title: '单位',
                    key: 'company',
                    align: 'center',
                    ellipsis: true,
                    tooltip: true,
                    placement: 'top-left',
                    width: 100,
                },
                {
                    title: '类别',
                    key: 'category',
                    align: 'center',
                    ellipsis: true,
                    tooltip: true,
                    width: 100,
                    placement: 'top-left',
                    render: (h, { row: { category } }) => {
                        return h('span', this.categoryObj[category].label);
                    },
                },
                {
                    title: '区域',
                    key: 'district',
                    align: 'center',
                    width: 100,
                    tooltip: true,
                },
                {
                    title: 'Url地址',
                    key: 'url',
                    align: 'center',
                    ellipsis: true,
                    tooltip: true,
                    width: 200,
                },
                {
                    title: 'IP',
                    key: 'ip',
                    align: 'center',
                    width: 100,
                    tooltip: true,
                },
                {
                    title: '行业',
                    key: 'industryName',
                    align: 'center',
                    width: 100,
                    tooltip: true,
                },
                {
                    title: '分组',
                    key: 'groupName',
                    align: 'center',
                    width: 100,
                    tooltip: true,
                },
                {
                    title: '基础分',
                    key: 'basicScore',
                    align: 'center',
                    width: 100,
                    tooltip: true,
                },
                {
                    title: '是否公共目标',
                    key: 'publicTarget',
                    align: 'center',
                    width: 100,
                    render: (h, params) => {
                        return h('span', {
                            style:{
                                color:params.row.publicTarget ? 'var(--status-yes)' : 'var(--status-no)'
                            }
                        },params.row.publicTarget ? '是' : '否');
                    },
                },
                {
                    title: '是否可用',
                    key: 'available',
                    align: 'center',
                    ellipsis: true,
                    tooltip: true,
                    placement: 'top-right',
                    render: (h, params) => {
                        return h(
                            'Poptip',
                            {
                                props: {
                                    confirm: true,
                                    'ok-text': '确定',
                                    'cancel-text': '取消',
                                    type: 'error',
                                    size: 'large',
                                    title: `你确定要${
                                        params.row.available == 1 ? '下线' : '上线'
                                    }目标吗?`,
                                    transfer: true,
                                    // disabled: params.row.available == 0
                                },
                                on: {
                                    'on-ok': () => {
                                        this.modifyTopoTarget('online', params.row);
                                    },
                                },
                            },
                            [
                                h(
                                    'Button',
                                    {
                                        props: {
                                            type: params.row.available == 1 ? 'success' : 'default',
                                            size: 'small',
                                            ghost: params.row.available == 1,
                                            // disabled: params.row.available == 0
                                        },
                                        style:{
                                            background:params.row.available == 1 ? 'var(--status-yes)' : 'var(--status-no)',
                                            color:'#fff'
                                        }
                                    },
                                    params.row.available == 1 ? '是' : '否'
                                ),
                            ]
                        );
                    },
                },
                {
                    title: '经度',
                    key: 'x',
                    align: 'center',
                    width: 100,
                    tootip: true,
                },
                {
                    title: '纬度',
                    key: 'y',
                    align: 'center',
                    width: 100,
                    tootip: true,
                },
              {
                title: '中枢平台ID',
                key: 'centralPlatformId',
                align: 'center',
                width: 100,
                tootip: true,
                show:this.$route.query.path==='实网测试'
              },
              {
                title: '数据中心ID',
                key: 'dataCentralId',
                align: 'center',
                width: 100,
                tootip: true,
                show:this.$route.query.path==='实网测试'
              },
                {
                    title: '备注',
                    key: 'remark',
                    width: 200,
                    tooltip: true,
                },
                {
                    title: '提示',
                    key: 'hint',
                    width: 200,
                    tooltip: true,
                },
                {
                    title: '下线人',
                    key: 'modifierName',
                    width: 200,
                    render: (h, params) => {
                        return h(
                            'span',
                            params.row.available != 1 ? params.row.modifierName : '无'
                        );
                    },
                },
                {
                    title: '下线时间',
                    key: 'lastUpdateTime',
                    width: 200,
                    render: (h, params) => {
                        return h(
                            'span',
                            params.row.available != 1 ? params.row.lastUpdateTime : '无'
                        );
                    },
                },
                {
                    title: '绑定状态',
                    key: 'score',
                    align: 'center',
                    placement: 'top-right',
                    ellipsis: true,
                    tooltip: true,
                    render: (h, params) => {
                        return h(
                            'Tag',
                            {
                                props: {
                                    color: params.row.x && params.row.y ? 'var(--status-yes)' : 'var(--status-no)',
                                    type: 'border',
                                },
                                on: {
                                    click: () => {},
                                },
                            },
                            params.row.x && params.row.y ? '已绑定' : '未绑定'
                        );
                    },
                },
                {
                    title:'版本信息',
                    key:'edition',
                    tooltip:true
                },
                {
                    title: '操作',
                    key: 'action',
                    ellipsis: true,
                    width: 120,
                    placement: 'top-right',
                    action: true,
                    fixed:'right',
                    // show:(data) => {
                    //     return this.configMode !== 1
                    // },
                    opList:[
                        {
                            txt:'修改',
                            type:'modify',
                            disabled: () => {
                                return this.disabledAllBtn
                            },
                            fun:this.showAddAndUpdate,
                            // show:(data) => {
                            //     return this.configMode !== 1
                            // }
                        },
                        {
                            txt:'删除',
                            type:'delete',
                            tooltip:true,
                            disabled: () => {
                                return this.disabledAllBtn
                            },
                            fun:(data) => {
                                this.delTopoTarget(data.id)
                            },
                            title: '你确定要删除吗?',
                            // show:(data) => {
                            //     return this.configMode !== 1
                            // }
                        }
                    ],
                    // render: (h, params) => {
                    //     return h('div', [
                    //         h(
                    //             'Button',
                    //             {
                    //                 props: {
                    //                     type: 'text',
                    //                     size: 'small',
                    //                     disabled: this.disabledAllBtn,
                    //                 },
                    //                 style: {
                    //                     border: 'none',
                    //                     background: 'none',
                    //                     boxShadow: 'none',
                    //                     display: this.configMode === 1 ? 'none' : 'inline-block',
                    //                 },
                    //                 on: {
                    //                     click: () => {
                    //                         this.showAddAndUpdate(params.row);
                    //                     },
                    //                 },
                    //             },
                    //             [
                    //                 h('img', {
                    //                     attrs: {
                    //                         src: this.disabledAllBtn
                    //                             ? require('../../../../assets/project/modifys.png')
                    //                             : require('../../../../assets/project/modifys-h.png'),
                    //                     },
                    //                     style: {
                    //                         cursor: 'pointer',
                    //                         'vertical-align': 'middle',
                    //                         display: 'inline-block',
                    //                         marginBottom: '4px',
                    //                     },
                    //                 }),
                    //             ]
                    //         ),
                    //         h(
                    //             'Poptip',
                    //             {
                    //                 props: {
                    //                     confirm: true,
                    //                     'ok-text': '确定',
                    //                     'cancel-text': '取消',
                    //                     type: 'error',
                    //                     size: 'large',
                    //                     title: '你确定要删除吗?',
                    //                     transfer: true,
                    //                 },
                    //                 on: {
                    //                     'on-ok': () => {
                    //                         this.delTopoTarget(params.row.id);
                    //                     },
                    //                 },
                    //             },
                    //             [
                    //                 h(
                    //                     'Button',
                    //                     {
                    //                         props: {
                    //                             type: 'text',
                    //                             size: 'small',
                    //                             disabled: this.disabledAllBtn,
                    //                         },
                    //                         style: {
                    //                             border: 'none',
                    //                             background: 'none',
                    //                             boxShadow: 'none',
                    //                             display:
                    //                                 this.configMode === 1 ? 'none' : 'inline-block',
                    //                         },
                    //                     },
                    //                     [
                    //                         h('img', {
                    //                             attrs: {
                    //                                 src: this.disabledAllBtn
                    //                                     ? require('../../../../assets/project/delNote-d.png')
                    //                                     : require('../../../../assets/project/delNote-h.png'),
                    //                             },
                    //                             style: {
                    //                                 cursor: 'pointer',
                    //                                 'vertical-align': 'middle',
                    //                                 display: 'inline-block',
                    //                                 marginBottom: '4px',
                    //                             },
                    //                         }),
                    //                     ]
                    //                 ),
                    //             ]
                    //         ),
                    //     ]);
                    // },
                },
            ],
            topoTargetData: [],
            topoTargetTotal: 0,
            selectTargetTeams:[],
            TargetId: '',
            projectInfo: {},
            subnetList: [],
            districtList: [],
            exportAdminUrl: '',
            //目标数量检测
            checkModal: false,
            checkList: [],
            checkCol: [
                {
                    title: '验证结果',
                    key: 'msg',
                },
                {
                    title: '导入的区域',
                    key: 'district',
                },
                {
                    title: '导入的总量',
                    key: 'count',
                },
                {
                    title: '拓扑图总量',
                    key: 'topoCount',
                },
                {
                    title: '是否足够',
                    key: 'enough',
                },
            ],
            industryList: [],
            companyList: [],
            selectAll: false,
            downloadTargetUrl: `/api/compete/topoTarget/exportTarget/${this.$route.query.prjid}/${this.$route.query.name}`,
            companyFormValidate: {
                newCompany: '',
                oldCompany: '',
            },
            companyRuleValidate: {
                newCompany: [{ required: true, message: '不能为空', trigger: 'change' }],
                oldCompany: [{ required: true, message: '不能为空', trigger: 'change' }],
            },
            companyModal: {
                show: false,
                loading: true,
                title: '修改单位',
            },
            applicationData:[]
        };
    },
    computed: {
        ...mapGetters(['showAsset']),
        categoryArr() {
            return Object.values(this.categoryObj);
        },
        checkTargetIds() {
            return this.selectTargetTeams.map((item) => item.id);
        },
        disCheckAll() {
            return this.topoTargetData.every((item) => item.disabled);
        },
        disabledName(){
            return this.formValidate.businessSystemId ? true : false
        },
        disabledEdition(){
            return (this.formValidate.businessSystemId  || this.targetModal.type == 2) ? true : false
        },
        showTip(){
            return this.showAddTarget ? '存在没有完善信息的靶标系统！请到资产管理->资产信息管理完善靶标系统的资产绑定信息，否则影响漏洞审核业务的正常进行,请上传xlsx格式文件' : '请上传xlsx格式文件'
        },
    },
    filters: {},
    async mounted() {
        await this.getIndustryTypes();
        this.getProjectInfo();
        this.getDistricts();
        this.exportAdminUrl = `../../api/compete/targetAdmin/exportExcel?projectId=${this.$route.query.prjid}&testId=${this.$route.query.id}`;
        this.getAccessGroupList();
        this.getTopoTargetList();
        this.getDeclareCompanyList();
        if(this.showAsset){
            this.getBusinessSystemList()
        }
        if (this.type == 1) {
            this.topoTargetCol.splice(2, 0, {
                title: '题目名称',
                key: 'questionName',
                align: 'center',
                ellipsis: true,
                tooltip: true,
                width: 160,
            });
        }
    },
    methods: {
         // 选择数据
        changePropertyId(id){
            if(id){
                this.currentAssetInfo = this.applicationData.find(item => item.id == id) || {};
              
                this.formValidate.company = this.currentAssetInfo.institutionName||'无'
                this.formValidate.businessSystemId = this.currentAssetInfo.id
                this.formValidate.name = this.currentAssetInfo.name
                this.formValidate.remark = this.currentAssetInfo.description
            }else{
                this.currentAssetInfo = {}
                this.formValidate.businessSystemId = ''
                this.formValidate.name = ''
                this.formValidate.remark = ''
            }
        },
        // 获取业务数据
        getBusinessSystemList(){
            let params = {
                onProduct:true,
                pageIndex:1,
                pageSize:999999
            }
            getBusinessSystemList(params).then(res=>{
                if(res.code == 1){
                    this.applicationData = res.data.items
                  
                    
                 }else{
                    this.applicationData = []
                    this.$Message.error(res.message)
                 }
            }).catch(error=>{
                console.log(error);
            })
        },
        mixinBeforeUpload(file){
            // const fileSize = file.size / 1024 / 1024 > this.$store.state.common.fileMax;
            // if(fileSize){
            // this.$Message.error({
            //     content: `文件大小不能大于${this.$store.state.common.fileMax}M`,
            //     duration: 2
            // });
            // return false;
            // }
        },
        // 点击模板下载按钮，需要触发事件
        downloadTemplate() {
            this.$refs.downloadTemplateBtn.$el.querySelector('a').click();
        },
        // 获取单位列表
        getDeclareCompanyList() {
            getDeclareCompanyList(this.$route.query.prjid)
                .then(({ code, data, message }) => {
                    if (code === 1) {
                        this.companyList = data;
                    } else {
                        this.$Message.warning(message);
                    }
                })
                .catch((error) => {});
        },
        // 获取行列列表
        getIndustryTypes() {
            return new Promise((resolve) => {
                allDirection({ dictTypeID: 'hwIndustryTypes' })
                    .then(({ code, message, attribute = {} }) => {
                        attribute = attribute.attribute || [];
                        if (code !== 1) {
                            this.$Message.warning(message);
                            return;
                        }
                        let list = [];
                        attribute.forEach((item) => (list = list.concat(item.dictEntryList)));
                        this.industryList = list;
                    })
                    .catch(() => {
                        this.$Message.error('获取行业列表异常');
                    })
                    .finally(() => {
                        resolve();
                    });
            });
        },
        // 下发团队规则或者竞赛系统路由规则
        issuedRules() {
            this.issuedLoading = true;
            issuedRules(this.$route.query.id)
                .then(async ({ code, message }) => {
                    if (code !== 1) {
                        this.cancelBtnLoading();
                        this.$Message.warning(message);
                    } else {
                        this.$Message.success('下发规则成功');
                        // self->TabPane->Tabs->hwDrillDetail，所以需要三个$parent
                        this.$parent.$parent.$parent.changePreDefault('routerRules');
                    }
                })
                .catch(() => {
                    this.cancelBtnLoading();
                    this.$Message.error(`下发规则异常`);
                });
        },
        cancelBtnLoading() {
            this.issuedLoading = false;
        },
        getExecutionsResult(ids) {
            return new Promise((resolve, reject) => {
                getExecutionsResult(ids)
                    .then((data) => {
                        if (data.code == 1) {
                            resolve(data);
                        } else {
                            this.$Message.warning(data.message);
                            reject();
                        }
                    })
                    .catch((error) => {
                        this.$Message.error('查询下发状态异常');
                        reject();
                    });
            });
        },
        awaitWrap(promise) {
            return promise.then((data) => [null, data]).catch((err) => [err, null]);
        },
        initData() {
            this.formValidate = {
                company: '',
                district: '', //区域
                id: '',
                industry: '',
                url: '',
                projectId: this.$route.query.prjid,
                available: '1',
                publicTarget: '',
                groupName: '',
                basicScore: 0,
                remark: '',
                hint: '',
            };
        },
        showAddAndUpdate(info) {
            this.initData();
            this.targetModal.show = true;
            if (!info) {
                this.targetModal.title = '添加目标';
                this.targetModal.type = 1;
                this.access = '1';
                this.formValidate.basicScore = 0;
                this.formValidate.businessSystemIdbck=undefined
            } else {
                this.targetModal.title = '修改目标';
                info.businessSystemIdbck = info.businessSystemId
                info.businessSystemName = info.name
                this.targetModal.type = 2;
                this.formValidate = JSON.parse(JSON.stringify(info));
                this.formValidate.publicTarget = info.publicTarget ? '1' : '0';
                this.formValidate.available = info.available ? '1' : '0';
                this.formValidate.basicScore = info.basicScore || 0;
                this.formValidate.x = info.x || '';
                this.formValidate.y = info.y || '';
            }
        },
        addTopoTarget() {
            let params = JSON.parse(JSON.stringify(this.formValidate));
            params.publicTarget = params.publicTarget === '1';
            params.testId = this.$route.query.id;
            params.available = params.available === '1' ? true : false;
            params.showAsset = this.showAsset // 控制是否走业务接口 true || false
            addTopoTarget(params)
                .then((data) => {
                    if (data.code == 1) {
                        this.getTopoTargetList();
                        this.handleReset('formValidate');
                        this.targetModal.show = false;
                    } else {
                        this.cancelLoading('targetModal');
                        this.$Message.warning(data.message);
                    }
                })
                .catch((error) => {
                    this.cancelLoading('targetModal');
                    this.$Message.error(error.response.data.message || error);
                });
        },
        modifyTopoTarget(type, data) {
            let params;
            if (type === 'online') {
                params = JSON.parse(JSON.stringify(data));
                params.available = data.available === true ? '0' : '1';
            } else {
                params = JSON.parse(JSON.stringify(this.formValidate));
            }
            // publicTarget字段是布尔值直接使用，否认进行计算取值
            params.publicTarget =
                typeof params.publicTarget === 'boolean'
                    ? params.publicTarget
                    : params.publicTarget === '1';
            params.testId = this.$route.query.id;
            params.available = params.available === '1' ? true : false;
            params.showAsset = this.showAsset // 控制是否走业务接口 true || false
            modifyTopoTarget(params)
                .then((data) => {
                    if (data.code == 1) {
                        this.getTopoTargetList();
                        this.$Message.success('操作成功');
                        this.handleReset('formValidate');
                        this.targetModal.show = false;
                    } else {
                        this.cancelLoading('targetModal');
                        this.$Message.warning(data.message);
                    }
                })
                .catch((error) => {
                    this.cancelLoading('targetModal');
                    this.$Message.error(error.response.data.message || error);
                });
        },
        saveTopoTarget() {
            this.$refs['formValidate'].validate((valid) => {
                if (valid) {
                    if (this.targetModal.type == 1) {
                        this.addTopoTarget();
                    } else {
                        this.modifyTopoTarget();
                    }
                } else {
                    this.cancelLoading('targetModal');
                }
            });
        },
        // 点击全选
        selectAllChange(val) {
            this.topoTargetData.forEach((item) => {
                if (!item.publicTarget) {
                    this.$set(item, 'checked', val);
                }
            });
        },
        // 修改全选的状态
        changeSelectAll(state, item) {
            for (let i = 0, length = this.topoTargetData.length; i < length; i++) {
                if (item.id === this.topoTargetData[i].id) {
                    this.$set(this.topoTargetData[i], 'checked', state);
                }
                if (!this.topoTargetData[i].checked) {
                    this.selectAll = false;
                    return;
                }
            }
            this.selectAll = true;
        },
        //批量设为公共
        batchSetTopoTargetPublic() {
            let ids = this.checkTargetIds;
            batchSetTopoTargetPublic(this.$route.query.id, ids)
                .then((res) => {
                    let { code, data, message } = res;
                    if (code == 1) {
                        this.$Message.info('设为公共目标成功');
                        this.selectTargetTeams = [];
                        this.getTopoTargetList();
                    } else {
                        this.$Message.error(message);
                    }
                })
                .catch((error) => {
                    this.$Message.error('设为公共目标失败');
                });
        },
        getTopoTargetList() {
            getTopoTargetList(this.queryTopoTargetInfo).then((data) => {
                if (data.code == 1) {
                    let list = data.data.items || data.data;
                    this.topoTargetData = list.map((item) => {
                        item.industryName = this.getIndustryName(item.industry);
                        item.disabled = item.publicTarget ? true : false;
                        return item;
                    });
                    this.selectAll = false;
                    this.topoTargetTotal = data.data.total;
                } else {
                    this.$Message.warning(data.message);
                }
            });
        },
        // 将行业Id转换为对应的名称
        getIndustryName(industryId) {
            let item = this.industryList.find((item) => item.dictid === industryId);
            // 返回对应的名称，没有查到数据，还是返回ID
            return item ? item.dictname : industryId;
        },
        delTopoTarget(id) {
            let projectId = this.$route.query.prjid;
            delTopoTarget(id, projectId)
                .then((data) => {
                    if (data.code == 1) {
                        // 删除后展示当前页，当前页没有数据展示前一页
                        this.$Message.success('删除成功');
                        this.queryTopoTargetInfo.pageIndex =
                            this.topoTargetData.length == 1 &&
                            this.queryTopoTargetInfo.pageIndex > 1
                                ? this.queryTopoTargetInfo.pageIndex - 1
                                : this.queryTopoTargetInfo.pageIndex;
                        this.getTopoTargetList();
                    } else {
                        this.$Message.warning(data.message);
                    }
                })
                .catch(() => {
                    this.$Message.error('删除异常');
                });
        },
        cancelLoading(name) {
            this[name].loading = false;
            setTimeout(() => {
                this[name].loading = true;
            });
        },
        typeFilter(val) {
            let str = '';
            switch (val) {
                case 0:
                    str = 'Flag';
                    break;
                case 1:
                    str = '多个虚拟机Flag相同';
                    break;
                case 2:
                    str = '多个虚拟机Flag不同';
                    break;
                case 3:
                    str = '文档';
                    break;
                default:
                    break;
            }
            return str;
        },
        statusFilter(val) {
            let str = '';
            switch (val) {
                case 1:
                    str = '正常/防护成功';
                    break;
                case 2:
                    str = '被攻破';
                    break;
                case 3:
                    str = '服务异常';
                    break;
                case 4:
                    str = '被攻破+服务异常';
                    break;
                default:
                    break;
            }
            return str;
        },
        getAllVmlist(partyId, imageId) {
            let params = {
                page: 1,
                pageSize: 10000,
                sortBy: 'name',
                order: 'asc',
                findPorts: true,
            };
            if (this.question) {
            }
            if (this.group) {
                params.party = this.group.partyId;
            }
            queryVmWithParty(this.routeParams.prjid, params).then((data) => {
                if (data.code == 1) {
                    this.vmlists = data.data.list || data.data;
                    if (this.vmlists.length > 0) {
                        let server = this.vmlists.filter(
                            (vm) => vm.id == this.formValidate.vmId
                        )[0];
                        if (server) {
                            this.getFlagServerList(server.address[0].ips[0].ipAddress);
                        }
                    }
                }
            });
        },
        getAccessGroupList() {
            if (!this.routeParams.id) {
                return;
            }
            let params = {
                pageIndex: 1,
                pageSize: 2147483647,
                testId: this.routeParams.id,
            };
            this.selectGroupList = [];
            getaccessgrouplist(params).then((data) => {
                if (data.code == 1) {
                    this.accessGroupList = data.data.items;
                } else if (data.code == -2) {
                    this.accessGroupList = [];
                } else {
                    this.$Message.warning(data.message);
                }
            });
        },
        getTargetSize(size) {
            this.queryTopoTargetInfo.pageSize = size;
            this.getTopoTargetList();
        },
        debounceSearch: debounce(function () {
            this.getTargetPage(1);
        }, 500),
        getTargetPage(page) {
            this.queryTopoTargetInfo.pageIndex = page;
            this.getTopoTargetList();
        },
        setTeamQuestion(val) {
            if (!val) {
                return;
            }
            this.question = this.questionList.filter((question) => question.chaId == val)[0];
            this.formValidate.port = this.question.port;
            this.getAllVmlist();
        },
        changeTeamGroup(val) {
            this.formValidate.vmId = '';
            if (!val) {
                return;
            }
            this.setTeamGroup(val);
        },
        setTeamGroup(val) {
            if (!val) {
                return;
            }
            this.group = this.accessGroupList.filter((group) => group.id == val)[0];
            this.formValidate.teamName = this.group.name;
            this.getAllVmlist();
        },
        handleReset(name) {
            this.initData();
            this.$refs[name].fields.forEach(function (e) {
                if (e.fieldValue != undefined && e.fieldValue != '') {
                    e.resetField();
                }
            });
        },
        changeVm(id) {
            this.formValidate.path = '';
            this.getVmIp(id);
        },
        getVmIp(id) {
            if (id) {
                let server = this.vmlists.filter((vm) => vm.id == id)[0];
                this.getFlagServerList(server.address[0].ipv4);
            }
        },
        getFlagServerList(ip) {
            let curIp = ip.split('.').slice(0, 3).join('.');
            let params = {
                page: 1,
                pageSize: 1000,
                projectId: this.$route.query.prjid,
                ip: curIp,
            };
            getFlagServerList(params).then((data) => {
                if (data.code == 1) {
                    //this.pathList = data.data.list;
                    this.formValidate.path = data.data.list[0].addresses[0].applyFlagUrl;
                }
            });
        },
        changeAccess(access) {},
        showImportModal() {},
        importFromExcel() {
            importTarget(this.$route.query.id).then((data) => {
                if (data.code == 1) {
                }
            });
        },
        getImageUrl(res) {
            if (res.code == 1) {
                this.queryTopoTargetInfo.pageIndex = 1;
                this.queryTopoTargetInfo.district = '';
                this.queryTopoTargetInfo.company = '';
                this.queryTopoTargetInfo.url = '';
                this.queryTopoTargetInfo.industry = '';
                this.queryTopoTargetInfo.groupName = '';
                this.queryTopoTargetInfo.category = '';
                this.$Message.success(
                    '导入成功，请前往"报告持续提交"页面，修改包含“目标方管理员组”的任务'
                );
                this.getTopoTargetList();
            } else {
                this.$Message.warning(res.message);
            }
        },
        getProjectInfo() {
            getstatusbyprjid(this.$route.query.prjid).then((data) => {
                if (data.code == 1) {
                    this.projectInfo = data.attribute;
                }
            });
        },
        getProjectSubnet() {
            queryNetworkList(this.$route.query.prjid, this.projectInfo.network.id).then((data) => {
                if (data.code == 1) {
                    let subnetList = [];
                    data.attribute.editorStage.childs.forEach((item) => {
                        subnetList = subnetList.concat(item.childs);
                    });
                    this.subnetList = [
                        ...new Set(
                            subnetList
                                .filter((subnet) => subnet.district)
                                .map((subnet) => subnet.district)
                        ),
                    ];
                }
            });
        },
        getDistricts() {
            //获取区域列表
            let params = {
                projectId: this.$route.query.prjid,
            };
            getDistricts(params).then((data) => {
                if (data.code == 1) {
                    this.districtList = data.data.list;
                }
            });
        },
        exportAdminExcel() {
            //导出管理员列表
            let params = {
                projectId: this.$route.query.prjid,
                testId: this.$route.query.id,
                companyId: '',
            };
            exportAdminExcel(params).then((data) => {
                if (data.code == 1) {
                } else {
                    this.$Message.warning(data.message);
                }
            });
        },
        //分配目标位置
        assignTopoTargetPos() {
            let projectId = this.$route.query.prjid;
            assignTopoTargetPos(projectId)
                .then((data) => {
                    if (data.code == 1) {
                        this.$Message.success('分配成功');
                        this.getTopoTargetList();
                    } else {
                        this.$Message.error(data.message);
                    }
                })
                .catch((error) => {
                    this.$Message.error('服务异常');
                });
        },
        //校验区域靶标位置数量
        checkTopoTargetPosNum() {
            let projectId = this.$route.query.prjid;
            checkTopoTargetPosNum(projectId)
                .then((data) => {
                    if (data.code == 1) {
                        this.checkList = data.data;
                        this.checkModal = true;
                    } else {
                        this.checkList = [];
                        this.$Message.error(data.message);
                    }
                })
                .catch((error) => {
                    this.$Message.error('服务异常');
                });
        },
        openCompanyModal() {
            this.$refs.companyFormValidate.resetFields();
            this.companyModal.show = true;
        },
        updateTargetCompany() {
            this.$refs.companyFormValidate
                .validate((valid) => {
                    if (valid) {
                        let data = {
                            newCompany: this.companyFormValidate.newCompany,
                            oldCompany: this.companyFormValidate.oldCompany,
                            sceneId: this.$route.query.id,
                        };
                        updateTargetCompany(this.$route.query.id, data)
                            .then((data) => {
                                if (data.code == 1) {
                                    this.getTopoTargetList();
                                    this.companyModal.show = false;
                                    this.$Message.info('修改成功');
                                } else {
                                    this.$Message.error(data.message);
                                }
                                this.cancelLoading('companyModal');
                            })
                            .catch((error) => {
                                this.cancelLoading('companyModal');
                                this.$Message.error('服务异常');
                            });
                    } else {
                        this.cancelLoading('companyModal');
                    }
                })
                .catch((error) => {
                    this.cancelLoading('companyModal');
                });
        },
        cancelLoading(modal) {
            this[modal].loading = false;
            setTimeout(() => {
                this[modal].loading = true;
            });
        },
    },
    beforeDestroy() {
        clearTimeout(this.timer);
    },
};
</script>
<style scoped>
.mr15 {
    margin-right: 15px;
}
</style>
<style>
.drillsTable .ivu-poptip-body {
    text-align: left !important;
}
.scenesHeader {
    margin-bottom: 16px;
}
.drillTables {
    min-height: 300px;
}
.drillsTable.ivu-table-wrapper {
    overflow: inherit;
}
.targetHeader {
    /*padding: 10px;*/
    margin: 15px 0;
}
.targetHeader .flex {
    display: flex;
    justify-content: space-between;
}
.active-zone {
    margin-bottom: -8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.active-zone > div,
.active-zone > button {
    margin-right: 15px;
    margin-bottom: 8px;
}
.list{
    overflow: visible !important;
}
</style>
